
Security News
vlt Launches "reproduce": A New Tool Challenging the Limits of Package Provenance
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
Browserify plugin for compiling TypeScript
var browserify = require('browserify');
var tsify = require('tsify');
browserify()
.add('main.ts')
.plugin('tsify', { noImplicitAny: true })
.bundle()
.on('error', function (error) { console.error(error.toString()); })
.pipe(process.stdout);
$ browserify main.ts -p [ tsify --noImplicitAny ] > bundle.js
Note that when using the Browserify CLI, compilation will always halt on the first error encountered, unlike the regular TypeScript CLI. This behavior can be overridden in the API, as shown in the API example.
Just plain ol' npm installation:
npm install browserify
npm install tsify
For use on the command line, use the flag npm install -g
.
--debug
option is set on Browserify.-d, --declaration
- See tsify#15-m, --module
- This is defaulted to CommonJS automatically (or None when in ES6 mode).--out, --outDir
- Use Browserify's file output options instead. These options are overridden because tsify writes to an internal memory store before bundling, instead of to the filesystem.--typescript
- This allows you to pass in a different TypeScript compiler, such as NTypeScript. When using the API you can either pass in the name of the alternative compiler or a reference to the compiler.tsify will automatically read options from tsconfig.json
. However, some options from this file will be ignored:
compilerOptions.declaration
- See tsify#15compilerOptions.module
- This is defaulted to CommonJS automatically (or None when in ES6 mode).compilerOptions.out
and compilerOptions.outDir
- Use Browserify's file output options instead. These options are overridden because tsify writes to an internal memory store before bundling, instead of to the filesystem.files
- Use Browserify's file input options instead. This is necessary because Browserify needs to know which file(s) are the entry points to your program.Yes! tsify can do incremental compilation using watchify, resulting in much faster incremental build times. Just follow the Watchify documentation, and add tsify as a plugin as indicated in the documentation above.
No problem. See the Gulp recipes on using browserify and watchify, and add tsify as a plugin as indicated in the documentation above.
Use grunt-browserify and you should be good! Just add tsify as a plugin in your Grunt configuration.
The inlined sourcemaps that Browserify generates may not be readable by IE 11 for debugging purposes. This is easy to fix by adding exorcist to your build workflow after Browserify.
There are several TypeScript compilation transforms available on npm, all with various issues. The TypeScript compiler automatically performs dependency resolution on module imports, much like Browserify itself. Browserify transforms are not flexible enough to deal with multiple file outputs given a single file input, which means that any working TypeScript compilation transform either skips the resolution step (which is necessary for complete type checking) or performs multiple compilations of source files further down the dependency graph.
tsify avoids this problem by using the power of plugins to perform a single compilation of the TypeScript source up-front, using Browserify to glue together the resulting files.
MIT
*.tsx
to Browserify's list of extensions if --jsx
is set (with priority *.ts > *.tsx > *.js).--inlineSourceMap
and --inlineSources
(because that's what Browserify expects).lib.d.ts
to support TypeScript 1.6 and to work with the --typescript
option.preserve
.*.tsx
to the regex determining whether to run a file through the TypeScript compiler.file
event to trigger watchify even when there are fatal compilation errors.--typescript
option.--out
and --outDir
compiler options.tsconfig.json
support.stopOnError
option and changed default behavior to continue building when there are typing errors.bundler.add()
.watchify
.FAQs
Browserify plugin for compiling Typescript
The npm package tsify receives a total of 26,816 weekly downloads. As such, tsify popularity was classified as popular.
We found that tsify demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 3 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
Research
Security News
Socket researchers uncovered a malicious PyPI package exploiting Deezer’s API to enable coordinated music piracy through API abuse and C2 server control.
Research
The Socket Research Team discovered a malicious npm package, '@ton-wallet/create', stealing cryptocurrency wallet keys from developers and users in the TON ecosystem.